#include "dsp.h"
code unsigned char segCode[10] = {0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
static unsigned char segCom = 0;
static unsigned char dotCom = 255;
unsigned char seg_buffer[8] = {0,1,2,3,4,5,6,7};

void seg_display(void)
{
	SEG(0xff);
	COM(1 << segCom);
	
	if(segCom == dotCom){
		SEG(segCode[seg_buffer[segCom]] & 0x7f);
	}else{
		SEG(segCode[seg_buffer[segCom]]);
	}
	
	if(++segCom >= 8)
	{
		segCom = 0;
	}
}